﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace LibraryManagement.Custom_Controls
{
    public partial class libTextBoxNumeric : libTextBox
    {
        public libTextBoxNumeric()
        {
            InitializeComponent();
        }

        private void libTextBoxNumeric_TextChanged(object sender, EventArgs e)
        {
            Match match = Regex.Match(this.Text, @"[\s\p{P}\p{S}\p{L}]");
            if (match.Success)
            {
                var matchText = match.Groups[0].Value;
                var text = this.Text.Replace(matchText, "");
                this.Text = null;
                this.AppendText(text);
            }
        }
    }
}
